package com.lanqian.Service.Impl;

import com.lanqian.Service.IStudentService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class QueryStudentByIdServlet extends HttpServlet {

   private IStudentService studentService; //通过springioc容器将student Service注入给Servlet


    public void setStudentService(IStudentService studentService) {
        this.studentService = studentService;
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse resource) throws ServletException, IOException {


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse resource) throws ServletException, IOException {

       studentService=new StudentServiceImpl();
        String name= studentService.queryStudentById();
        request.setAttribute("name",name);
        request.getRequestDispatcher("result.jsp").forward(request,resource);

    }
}
